
using System;
using System.Collections;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using ZedGraph;
namespace NCS_CS
{
	public partial class MyZed
	{
		public void setscale(double x1, double y1, double x2, double y2)
		{
			this.myscale(x1, y1, x2, y2);
		}
		public void myscale(double x1, double y1, double x2, double y2)
		{
			GraphPane myPane = this.GraphPane;
			myPane.XAxis.Scale.Min = x1;
			myPane.XAxis.Scale.Max = x2;
			myPane.YAxis.Scale.Min = y1;
			myPane.YAxis.Scale.Max = y2;
			this.AxisChange();
			this.Refresh();
		}
		public void setxyformat( string xf,  string yf)
		{
		}
		public void setxyDw(string x,  string y)
		{
			//Me.setregion
			GraphPane myPane = this.GraphPane;
			myPane.XAxis.Title.Text = x;
			myPane.YAxis.Title.Text = y;
			this.Refresh();
		}
		public void setArrV(ref double[] vx, ref double[] vy, int vn, int idx)
		{
			int n = 0;
			GraphPane myPane = this.GraphPane;
			n = myPane.CurveList.Count;
			int i = 0;
			if (idx < n) {
				myPane.CurveList[Convert.ToString(idx)].Clear();

				PointPairList vList = new PointPairList();
				for (i = 0; i <= vn - 1; i++) {
					myPane.CurveList[Convert.ToString(idx)].AddPoint(vx[i], vy[i]);
				}
			}

		}

        //public void setArr(ref double[] vx, ref double[] vy, int vn, int idx)
        //{
        //    int n = 0;
        //    GraphPane myPane = this.GraphPane;
        //    n = myPane.CurveList.Count;
        //    int i = 0;
        //    if (idx < n) {
        //        myPane.CurveList[Convert.ToString(idx)].Clear();
        //        PointPairList vList = new PointPairList();
        //        for (i = 0; i <= vn - 1; i++) {
        //            //vList.Add(vx[i], vy[i])
        //            myPane.CurveList[Convert.ToString(idx)].AddPoint(vx[i], vy[i]);
        //        }
        //    }
        //}
		public void setLineCount(int a)
		{
			GraphPane myPane = this.GraphPane;
			this.RestoreScale(this.GraphPane);
			myPane.CurveList.Clear();
			myPane.GraphObjList.Clear();
			LineItem myCurve = null;
			int i = 0;
			for (i = 0; i <= a - 1; i++) {
				myCurve = myPane.AddCurve(Convert.ToString(i), null, Color.Red, SymbolType.None );
                myCurve.Label.IsVisible = false;
			}

		}
		public void setTwoLine()
		{
			GraphPane myPane = this.GraphPane;
			myPane.CurveList.Clear();
			LineItem myCurve = myPane.AddCurve(Convert.ToString(0), null, Color.Blue, SymbolType.Circle);
			myCurve.Line.IsVisible = false;
			myCurve.Symbol.Fill = new Fill(Color.Blue);
			myCurve.Symbol.Size = 9;
			myCurve.Label.IsVisible = false;
			myPane.AddCurve(Convert.ToString(1), null, Color.Green, SymbolType.None);
		}
		public void fit()
		{
			draw();
		}
		public void draw()
		{

			this.AxisChange();
			this.Refresh();
		}
		public void clear()
		{
			GraphPane myPane = this.GraphPane;
			myPane.CurveList.Clear();
			this.Refresh();
		}
		public bool getlinevisible(int idx)
		{
			bool functionReturnValue = false;
			int n = 0;
			GraphPane myPane = this.GraphPane;
			n = myPane.CurveList.Count;
			if (idx < n) {
				functionReturnValue = myPane.CurveList[Convert.ToString(idx)].IsVisible;
			}
			return functionReturnValue;
		}
		public void setlinevisible(int idx, bool b)
		{
			int n = 0;
			GraphPane myPane = this.GraphPane;
			n = myPane.CurveList.Count;
			if (idx < n) {
				myPane.CurveList[Convert.ToString(idx)].IsVisible = b;
			}
		}
		public void setlinefill(int idx)
		{
			int n = 0;
			GraphPane myPane = this.GraphPane;
			n = myPane.CurveList.Count;
			LineItem l = null;
			if (idx < n) {
				l =(LineItem) myPane.CurveList[Convert.ToString(idx)];
				l.Line.Fill = new Fill(Color.White, Color.Red, 45f);
				this.Refresh();
			}
		}
		public void setlinecolor(int idx, Color c)
		{
			int n = 0;
			GraphPane myPane = this.GraphPane;
			n = myPane.CurveList.Count;
			if (idx < n) {
				myPane.CurveList[Convert.ToString(idx)].Color = c;
				this.Refresh();
			}
		}

		public void setshowpoint(bool b)
		{
		}
		public void setlinemode(int idx, int method1)
		{
			//Dim n As int
			//Dim myPane As GraphPane = Me.GraphPane
			//n = myPane.CurveList.Count
			//If idx < n Then
			//    myPane.CurveList(cstr(idx)).
			//End If
		}
		public void settitle(string s)
		{
			GraphPane myPane = this.GraphPane;
			myPane.Title.IsVisible = false;
		}
		public void setregion(int n1, int n2, int i)
		{

			if (n2 <= n1)
				return;
			int n = 0;
			GraphPane myPane = this.GraphPane;
			n = myPane.CurveList.Count;
			Color c = default(Color);
			int at = 0;
			double x = 0;
			double y = 0;
			LineItem l = null;
			if (i < n) {
				c = myPane.CurveList[Convert.ToString(i)].Color;
				for (at = n1; at <= n2; at++) {
					x = myPane.CurveList[i].Points[(int)at].X;
					y = myPane.CurveList[i].Points[(int)at].Y;
					myPane.CurveList[i + ModMain.NUMChanel].AddPoint(x, y);
				}
                l = (LineItem )myPane.CurveList[i + ModMain.NUMChanel];//todo
				l.Line.Fill = new Fill(c, c, 45);
				this.Refresh();
			}
		}


		public void setshowpeak(bool b)
		{
		}
		public void tmplineaddpoint(double x, double y, int idx)
		{
			int n = 0;
			GraphPane myPane = this.GraphPane;
			n = myPane.CurveList.Count;
			if (idx < n) {
				myPane.CurveList[Convert.ToString(idx)].AddPoint(x, y);
				this.AxisChange();
				this.Invalidate();
			}
		}
		public void init()
		{

		}
		public void starttmpline(double x, double y, int idx)
		{
			int n = 0;
			GraphPane myPane = this.GraphPane;
			n = myPane.CurveList.Count;
			if (idx < n) {
				myPane.CurveList[Convert.ToString(idx)].Clear();
				myPane.CurveList[Convert.ToString(idx)].AddPoint(x, y);
			}
		}


		public MyZed()
		{
			// This call is required by the Windows Form Designer.
			InitializeComponent();

			GraphPane myPane = this.GraphPane;
			myPane.Title.IsVisible = false;
		}
	}
}
